<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>判断2月天数</title>
</head>
<body>
    <script>
        var a =2024;
        var b = (a%4==0 && a%100!=0)||(a%400==0)?29:28
        document.write(a+"年2月有"+b+"天")
        alert(a+"年2月有"+b+"天")
    </script>
</body>
</html>